package com.diit.analysisitest;

import java.text.NumberFormat;

public class SafeConvertUtil {
	 public static String DoubleToString(Double d ,Integer pointAfterLength){
	       String s="";
	       try{
	           NumberFormat nf = NumberFormat.getNumberInstance();
	           nf.setMaximumFractionDigits(pointAfterLength);
	           s= nf.format(d);
	       }catch (Exception e){
	           e.printStackTrace();
	       }
	       return s;
	   }

	    public static String ReplaceAllBadChar(String str){
	        if (str == null || str.equals("") || str.equals("null"))
	            return "";
	        str = str.replaceAll("\\&[a-zA-Z]{1,10};", " ");
	        return str;

	    }
}
